﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Requests.aspx.cs" Inherits="Requests" MasterPageFile="~/Site.master" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<br/>
    <asp:HyperLink ID="OperLink" runat="server" NavigateUrl="~/Operator/OperatorPanel.aspx">Панель оператора</asp:HyperLink>&nbsp;→&nbsp;
    <b><asp:Label ID="Label1" runat="server" Text="Заявки" ForeColor="black"></asp:Label></b>
    <br/>
<br />
 <asp:GridView ID="RequestListGridView" runat="server" 
                    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
        onselectedindexchanged="RequestListGridView_SelectedIndexChanged" DataKeyNames="CreditRequestId">
                    <Columns>
                        <asp:CommandField SelectText="Рассмотреть" ShowSelectButton="True" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Название предприятия" 
                            SortExpression="CompanyName" />
                        <asp:BoundField DataField="Name" HeaderText="Кредит" SortExpression="Name" />
                        <asp:BoundField DataField="Amount" HeaderText="Сумма" 
                            SortExpression="Amount" />
                        <asp:BoundField DataField="Expr1" HeaderText="Валюта" SortExpression="Expr1" />
                        <asp:BoundField DataField="TermLength" HeaderText="Срок" 
                            SortExpression="TermLength" />
                        <asp:BoundField DataField="CreditRequestId" HeaderText="CreditRequestId" 
                            InsertVisible="False" ReadOnly="True" SortExpression="CreditRequestId" 
                            Visible="False" />
                    </Columns>
                    <EmptyDataTemplate>
                        Заявок нет.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
                    
        
        
        SelectCommand="SELECT Credit.Name, CreditRequest.Amount, CreditRequest.TermLength, Currency.Name AS Expr1, Company.CompanyName, CreditRequest.CreditRequestId FROM CreditRequest INNER JOIN Credit ON CreditRequest.CreditId = Credit.CreditID INNER JOIN Currency ON CreditRequest.CurrencyId = Currency.CurrencyID INNER JOIN UserProfile ON CreditRequest.UserProfileId = UserProfile.ProfileId INNER JOIN Company ON UserProfile.CompanyId = Company.CompanyId WHERE (CreditRequest.RequestStatusId = 0) AND (Credit.Active = 1)">
                </asp:SqlDataSource>
</asp:Content>